<?php
\backend\assets\ChartjsAsset::register($this);
?>
<?php $this->beginBlock('content') ?>
<div class="row">
    <div class="col-sm-12">
        <div class="white-box">
            <h3 class="box-title"></h3>
            <div class="row m-b-15">
                <div class="col-sm-12">
                    <canvas id="chart"></canvas>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->endBlock()?>
<?php $this->beginBlock("script")?>
<script>
    <?php
        $keys = $values = [];
        foreach ($plugsRunTotalList as $item) {
            $keys[] = $item['created_date'];
            $values[] = $item['terminal_num_sum'];
        }
    ?>

    var ctx = document.getElementById('chart').getContext('2d');
    var chart = new Chart(ctx, {
        // The type of chart we want to create
        type: 'line',

        // The data for our dataset
        data: {
            labels: <?= json_encode($keys) ?>,
            datasets: [{
                label: '业务运行详情',
                borderColor: 'rgb(37, 162, 255)',
                data: <?= json_encode($values) ?>,
                lineTension: 0,
                fill: false,
            }]
        },

        // Configuration options go here
        options: {}
    });

</script>
<?php $this->endBlock(); ?>
